import React from 'react';
import {Route} from 'react-router-dom';
import Loadable from 'react-loadable';
// import { renderRoutes } from 'react-router-config';
import Loading from '../components/loading';



// import a11 from '../components/a/a11';
// import a12 from '../pages/a/a12';
// import a13 from '../pages/a/a13';

// function getA11() {
//     return new Promise((resolve, reject)=> {
//         import('../pages/a/route.js').then((as)=> {
//             resolve(as.default.A11)
//         }, reject)
//     })
// }

// function getA12() {
//     return new Promise((resolve, reject)=> {
//         import('../pages/a/route.js').then(({A12})=> {
//             resolve(A12)
//         }, reject)
//     })
// }

// function getA13() {
//     return new Promise((resolve, reject)=> {
//         import('../pages/a/route.js').then(({A13})=> {
//             resolve(A13)
//         }, reject)
//     })
// }

const A11 = Loadable({
    loader: ()=> { 
        console.log('start import loading', +new Date());
        return import('../pages/a/route.js').then(({A11})=> A11)
    },
    delay: 0,
    loading: Loading
});

const A12 = Loadable({
    loader: ()=> import('../pages/a/route.js').then(({A12})=> A12),
    delay: 0,
    loading: Loading
})

const A13 = Loadable({
    loader: ()=> import('../pages/a/route.js').then(({A13})=> A13),
    delay: 0,
    loading: Loading
})

const B11 = Loadable({
    loader: ()=> import('../pages/b/route.js').then(({B11})=> B11),
    delay: 0,
    loading: Loading
});

const B12 = Loadable({
    loader: ()=> import('../pages/b/route.js').then(({B12})=> B12),
    delay: 0,
    loading: Loading
})

const B13 = Loadable({
    loader: ()=> import('../pages/b/route.js').then(({B13})=> B13),
    delay: 0,
    loading: Loading
})

// const Aroute = [{
//     path: '/a/a11',
//     exact: true,
//     component: A11
// }, {
//     path: '/a/a12',
//     exact: true,
//     component: A12
// }, {
//     path: '/a/a13',
//     exact: true,
//     component: A13
// }]



// import b11 from '../pages/b/b11';
// import b12 from '../pages/b/b12';
// import b13 from '../pages/b/b13';

const routes  =  (
    <div className='content'>
        <Route exact path="/a/a11" component={A11} />
        <Route exact path="/a/a12" component={A12} />
        <Route exact path="/a/a13" component={A13} />
        <Route exact path="/b/b11" component={B11} />
        <Route exact path="/b/b12" component={B12} />
        <Route exact path="/b/b13" component={B13} />
    </div>
)

export default routes;